﻿<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true" CodeFile="CapNhatTaiKhoan.aspx.cs" Inherits="CapNhatTaiKhoan" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <link type="text/css" href="jquery-ui/themes/base/ui.all.css"rel="stylesheet" />
	<script type="text/javascript" src="jquery-ui/ui/ui.core.js"></script>
	<script type="text/javascript" src="jquery-ui/ui/ui.datepicker.js"></script>
	<script type="text/javascript">
/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

        function echeck(str) {

		        var at="@"
		        var dot="."
		        var lat=str.indexOf(at)
		        var lstr=str.length
		        var ldot=str.indexOf(dot)
		        if (str.indexOf(at)==-1){
		          
		           return false
		        }

		        if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		           
		           return false
		        }

		        if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		            
		            return false
		        }

		         if (str.indexOf(at,(lat+1))!=-1){
		            
		            return false
		         }

		         if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		          
		            return false
		         }

		         if (str.indexOf(dot,(lat+2))==-1){
		            
		            return false
		         }
        		
		         if (str.indexOf(" ")!=-1){
		            
		            return false
		         }

 		         return true					
	        }

        
</script>
<script type="text/javascript">
	
		$(document).ready( function()
		{
			var checkEmail=0;
			
			$("#ctl00_ContentPlaceHolder1_txtEmail").blur(function ()
			{
			    var email=$("#ctl00_ContentPlaceHolder1_txtEmail").attr("value");
			    if(echeck(email)==true)
			    {
			        $("#emailErr").html("<span class='validMessage'>Hợp lệ</span>");
			        checkEmail=0;
			    }
			    else
			    {
			        $("#emailErr").html("<span class='invalidMessage'>Email không hợp lệ</span>");
			        checkEmail=1;
			    }
			});
			
			$("#ctl00_ContentPlaceHolder1_txtHoTen").blur(function()
			{
			    if($("#ctl00_ContentPlaceHolder1_txtHoTen").attr("value")!="")
			    {
			        $("#hoTenErr").html("");
			    }
			    
			    if($("#ctl00_ContentPlaceHolder1_txtHoTen").attr("value")=="")
			    {
			        $("#hoTenErr").html("<span class='invalidMessage'>Họ tên không được để trống</span>");
			    }
			});
	        
			$("#ctl00_ContentPlaceHolder1_btnSubmit").click(function ()
			{
			    var check=0;
			    if($("#ctl00_ContentPlaceHolder1_txtEmail").attr("value")=="")
			    { 
			        $("#emailErr").html("<span class='invalidMessage'>Email không được để trống</span>");
			        
			        check=1;
			    }
			    if($("#ctl00_ContentPlaceHolder1_txtHoTen").attr("value")=="")
			    { 
			        $("#hoTenErr").html("<span class='style4'>Bạn chưa nhập tên</span>");
			     
			        check=1;
			    }
			    if(checkEmail==1||check==1)
			    {
			        alert("Bạn điền thông tin trong form không hợp lệ");
			        return false;
			    }
			    return true;
			});
		});
		$(function() 
			{
		        $("#ctl00_ContentPlaceHolder1_txtNgaySinh").datepicker(
		        {
		            changeMonth: true,
			        changeYear: true
			    });
	        });
		
</script>
    <asp:label runat="server" ID="lbContent">
     <table id="tableUpdateAccount" style="font-weight:bold" border="0" align="center" cellpadding="4" cellspacing="0">
      <tr align="center">
        <td colspan="2" class="table_header">Cập nhật tài khoản</td>
        </tr>
      <tr>
        <td>Tên đăng nhập:</td>
        <td class="style4">
            <asp:Label runat="server" ID="lbUserName" class="validMessage"></asp:Label>
            <asp:HiddenField runat="server" ID="hidPassword" />
            <asp:HiddenField runat="server" ID="hidSoTaiKhoan" />
            <asp:HiddenField runat="server" ID="hidDiem" />
        </td>
      </tr>
      <tr>
        <td>Điểm:</td>
        <td><asp:Label runat="server" ID="lblDiem"></asp:Label></td>
      </tr>
      <tr>
        <td>Họ tên:</td>
        <td ><asp:TextBox runat="server" name="txtHoTen" ID="txtHoTen" class="textfield" 
                EnableTheming="True"></asp:TextBox>
            <div id="hoTenErr"></div>
        </td>
      </tr>
       <tr>
        <td>Email:</td>
        <td ><asp:TextBox runat="server" name="txtEmail" ID="txtEmail" class="textfield"></asp:TextBox>
          <div id="emailErr"></div>
        </td>
      </tr>      
      <tr>
        <td>Ngày sinh:</td>
        <td ><asp:TextBox runat="server" name="txtNgaySinh" ID="txtNgaySinh" class="textfield"></asp:TextBox>
        </td>
      </tr>
      <tr>
        <td>Địa chỉ:</td>
        <td ><asp:TextBox runat="server" name="txtDiaChi" ID="txtDiaChi" class="textfield"></asp:TextBox>
        </td>
      </tr>
      <tr>
        <td>Điện thoại:</td>
        <td ><asp:TextBox runat="server" name="txtDienThoai" ID="txtDienThoai" class="textfield"></asp:TextBox>
        </td>
      </tr>
      <tr>
        <td></td>
        <td><a href="ThayDoiMatKhau.aspx" class="linkStyle">Thay đổi mật khẩu?</a></td>
      </tr>
      <tr>
        <td></td>
        <td >
            <asp:Button runat="server" ID="btnSubmit" UseSubmitBehavior="true" 
                Text="Cập nhật" onclick="btnSubmit_Click"/></td>
      </tr>
    </table></asp:label>
</asp:Content>

